/**
 * @param {string} s
 * @return {string}
 */
export var removeOuterParentheses = function (s) {
  let [ans, count] = ['', 0]
  for (const c of s) {
    if (c === ')') count--
    if (count > 0) ans += c
    if (c === '(') count++
  }
  return ans
}
